package cn.javass.dp.observer.example4;

import java.util.ArrayList;
import java.util.List;

//定义水质检测者目标对象
public abstract  class WaterQualitySubject {

    protected List<WatcherObserver> observers = new ArrayList<>();

    public void attach(WatcherObserver observer) {
        observers.add(observer);
    }

    public void detach(WatcherObserver observer) {
        observers.remove(observer);
    }

    //通知观察者
    public abstract void notifyWatchers();

    //获取水质级别
    public abstract  int getPolluteLevel();
}
